package controller;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import service.WeatherService;

import java.util.List;

@Controller
public class Weather {
    public static String API_URL = "http://apis.juhe.cn/simpleWeather/query";
    public static String API_KEY = "0a6c1b156740c55bc287b94adcafe6db";
@Autowired
    private WeatherService weatherService;
@RequestMapping("/initS")
    public String initS(){
    return "searchWeather";
}
@RequestMapping("/searchW")
    public String searchW(String cityName, Model model){
    List<pojo.Weather> list=weatherService.queryWeather(cityName);
    model.addAttribute("w",list);
    return "searchWeather";
}



        }





